//
//  PersonView.m
//  Streaming
//
//  Created by 官琛 on 15-6-24.
//  Copyright (c) 2015年 liuxun. All rights reserved.
//

#import "PersonView.h"

@implementation PersonView

- (void)dealloc
{
    [self.scrollView release];
    [self.nameCn release];
    [self.nameEn release];
    [self.profession release];
    [self.birthMonth release];
    [self.birthDay release];
    [self.ratingFinal release];
    [self.address release];
    [self.content release];
    [self.button1 release];
    [self.image release];
    [self.unfold release];
    [self.titleLabel release];
    [self.movView release];
    [self.movImage1 release];
    [self.movName1 release];
    [self.movYear1 release];
    [self.movImage2 release];
    [self.movName2 release];
    [self.movYear2 release];
    [self.movImage3 release];
    [self.movName3 release];
    [self.movYear3 release];
    [self.firstButton release];
    [self.secondButton release];
    [self.thirdButton release];
    
    [super dealloc];
    
}

-(instancetype)initWithFrame:(CGRect)frame perId:(NSInteger)personId
{
    self = [super initWithFrame:frame];
    if (self) {
        self.perId = personId;
        [self afnGetRequest];
        if (WIDTH == 320 && HEIGHT == 568) {
            [self creatPerson5];
        }
        if (WIDTH == 414 && HEIGHT == 736) {
            [self creatPersonPlus];
        }
        if (WIDTH == 375 && HEIGHT == 667){
            [self creatPerson6];
        }

    }
    return self;

}

-(void)creatPerson5
{
    
    self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    self.scrollView.delegate = self;
    self.scrollView.contentSize = CGSizeMake(0, HEIGHT);
    self.scrollView.showsHorizontalScrollIndicator = NO;
    self.scrollView.userInteractionEnabled = YES;
    [self addSubview:self.scrollView];
    
    self.HUD = [MBProgressHUD showHUDAddedTo:self.scrollView animated:YES];
    self.HUD.labelText = @"正在加载中";
    [self.HUD show:YES];
    [self.HUD release];
    
    self.backImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 90)];
    //    [self.backImageView setBackgroundColor:[UIColor whiteColor]];
    [self.scrollView addSubview:self.backImageView];
    [self.backImageView release];
    
    self.image = [[UIImageView alloc]initWithFrame:CGRectMake(10, 40, 100, 140)];
    [self.scrollView addSubview:self.image];
    [_image release];
    
    self.ratingFinal = [[UILabel alloc]initWithFrame:CGRectMake(320, 40, 30, 30)];
    self.ratingFinal.textColor = [UIColor orangeColor];
    [self.scrollView addSubview:self.ratingFinal];
    [_ratingFinal release];
    
    self.nameCn = [[UILabel alloc]initWithFrame:CGRectMake(self.image.frame.origin.x+self.image.frame.size.width+10, self.image.frame.origin.y-10, 200, 30)];
    self.nameCn.font = [UIFont boldSystemFontOfSize:20];
    [self.scrollView addSubview:self.nameCn];
    [_nameCn release];
    
    self.nameEn = [[UILabel alloc]initWithFrame:CGRectMake(self.nameCn.frame.origin.x, self.nameCn.frame.origin.y+35, 200, 30)];
    [self.scrollView addSubview:self.nameEn];
    self.nameEn.font = [UIFont systemFontOfSize:14];
    [_nameEn release];
    
    self.birthDay = [[UILabel alloc]initWithFrame:CGRectMake(self.nameEn.frame.origin.x, self.nameEn.frame.origin.y+30, 100, 20)];
    self.birthDay.textColor = [UIColor lightGrayColor];
    self.birthDay.font = [UIFont systemFontOfSize:12];
    [self.scrollView addSubview:self.birthDay];
    [_birthDay release];
    
    self.address = [[UILabel alloc]initWithFrame:CGRectMake(self.birthDay.frame.origin.x, self.birthDay.frame.origin.y+20, 200, 20)];
    self.address.textColor = [UIColor lightGrayColor];
    self.address.font = [UIFont systemFontOfSize:12];
    [self.scrollView addSubview:self.address];
    [_address release];
    
    self.profession = [[UILabel alloc]initWithFrame:CGRectMake(self.address.frame.origin.x, self.address.frame.origin.y+20, 200, 20)];
    self.profession.textColor = [UIColor lightGrayColor];
    self.profession.font = [UIFont systemFontOfSize:12];
    [self.scrollView addSubview:self.profession];
    [_profession release];
    
    self.content = [[UILabel alloc]initWithFrame:CGRectMake(self.image.frame.origin.x, self.image.frame.origin.y+self.image.frame.size.height, 300, 80)];
    self.content.numberOfLines = 0;
    //    [self.content sizeToFit];
    self.content.userInteractionEnabled = YES;
    
    self.content.font = [UIFont systemFontOfSize:15];
    //    self.content.scrollEnabled = NO;
    [self.scrollView addSubview:self.content];
    [_content release];
    
    self.button1 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.button1.frame = CGRectMake(0, 0, 300, 80);
    [self.button1 addTarget:self action:@selector(button5Action:) forControlEvents:UIControlEventTouchUpInside];
    [self.content addSubview:self.button1];
    self.buttonState = NO;
    
    self.unfold = [[UIImageView alloc]initWithFrame:CGRectMake(135, self.content.frame.origin.y+self.content.frame.size.height - 10, 30, 30)];
//    [self.unfold setBackgroundColor:[UIColor redColor]];
    [self.scrollView addSubview:self.unfold];
    [_unfold release];
    
    //拍过电影***************
    self.movView = [[UIView alloc]initWithFrame:CGRectMake(0, self.content.frame.origin.y+self.content.frame.size.height + 5, WIDTH, 300)];
    //    self.movView.backgroundColor = [UIColor blackColor];
    self.movView.userInteractionEnabled = YES;
    [self.scrollView addSubview:self.movView];
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 80, 30)];
    self.titleLabel.text = @"主要作品";
    self.titleLabel.font = [UIFont boldSystemFontOfSize:20];
    [_titleLabel release];
    
    self.movImage1 = [[UIImageView alloc]initWithFrame:CGRectMake(10, self.titleLabel.frame.origin.y+50, 85, 110)];
    self.movImage1.userInteractionEnabled = YES;
    [self.movView addSubview:self.movImage1];
    [_movImage1 release];
    
    self.firstButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.firstButton.frame = CGRectMake(0, 0, self.movImage1.frame.size.width / 2, self.movImage1.frame.size.height / 2);
    [self.firstButton addTarget:self action:@selector(buttonAction1:) forControlEvents:UIControlEventTouchUpInside];
    [self.movImage1 addSubview:self.firstButton];
    
    
    self.movName1 = [[UILabel alloc]initWithFrame:CGRectMake(10, self.movImage1.frame.origin.y+self.movImage1.frame.size.height+10, self.movImage1.frame.size.width, 40)];
    self.movName1.numberOfLines = 0;
    self.movName1.font = [UIFont systemFontOfSize:14];
    self.movName1.textAlignment = NSTextAlignmentCenter;
    [self.movView addSubview:self.movName1];
    [_movName1 release];
    
    self.movYear1 = [[UILabel alloc]initWithFrame:CGRectMake(10, self.movName1.frame.origin.y+40, self.movName1.frame.size.width, 20)];
    self.movYear1.textAlignment = NSTextAlignmentCenter;
    self.movYear1.font = [UIFont systemFontOfSize:13];
    self.movYear1.textColor = [UIColor lightGrayColor];
    [self.movView addSubview:self.movYear1];
    [_movYear1 release];
    
    self.movImage2 = [[UIImageView alloc]initWithFrame:CGRectMake(self.movImage1.frame.origin.x+self.movImage1.frame.size.width+20, self.movImage1.frame.origin.y, 85, 110)];
    self.movImage2.userInteractionEnabled = YES;
    [self.movView addSubview:self.movImage2];
    [_movImage2 release];
    
    self.secondButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.secondButton.frame = CGRectMake(0, 0, self.movImage2.frame.size.width, self.movImage2.frame.size.height);
    [self.secondButton addTarget:self action:@selector(buttonAction2:) forControlEvents:UIControlEventTouchUpInside];
    [self.movImage2 addSubview:self.secondButton];
    
    
    self.movName2 = [[UILabel alloc]initWithFrame:CGRectMake(self.movImage2.frame.origin.x, self.movImage2.frame.origin.y+self.movImage2.frame.size.height+10, self.movImage2.frame.size.width, 40)];
    self.movName2.numberOfLines = 0;
    self.movName2.font = [UIFont systemFontOfSize:13];
    self.movName2.textAlignment = NSTextAlignmentCenter;
    [self.movView addSubview:self.movName2];
    [_movName2 release];
    
    self.movYear2 = [[UILabel alloc]initWithFrame:CGRectMake(self.movImage2.frame.origin.x, self.movName2.frame.origin.y+40, self.movName2.frame.size.width, 20)];
    self.movYear2.textAlignment = NSTextAlignmentCenter;
    self.movYear2.font = [UIFont systemFontOfSize:12];
    self.movYear2.textColor = [UIColor lightGrayColor];
    [self.movView addSubview:self.movYear2];
    [_movYear2 release];
    
    self.movImage3 = [[UIImageView alloc]initWithFrame:CGRectMake(self.movImage2.frame.origin.x+self.movImage2.frame.size.width+20, self.movImage2.frame.origin.y, 85, 110)];
    self.movImage3.userInteractionEnabled = YES;
    [self.movView addSubview:self.movImage3];
    [_movImage3 release];
    
    self.thirdButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.thirdButton.frame = CGRectMake(0, 0, self.movImage3.frame.size.width, self.movImage3.frame.size.height);
    [self.thirdButton addTarget:self action:@selector(buttonAction3:) forControlEvents:UIControlEventTouchUpInside];
    [self.movImage3 addSubview:self.thirdButton];
    
    
    self.movName3 = [[UILabel alloc]initWithFrame:CGRectMake(self.movImage3.frame.origin.x, self.movImage3.frame.origin.y+self.movImage3.frame.size.height+10, self.movImage3.frame.size.width, 40)];
    self.movName3.numberOfLines = 0;
    self.movName3.font = [UIFont systemFontOfSize:13];
    self.movName3.textAlignment = NSTextAlignmentCenter;
    [self.movView addSubview:self.movName3];
    [_movName3 release];
    
    self.movYear3 = [[UILabel alloc]initWithFrame:CGRectMake(self.movImage3.frame.origin.x, self.movName3.frame.origin.y+40, self.movName1.frame.size.width, 20)];
    self.movYear3.textAlignment = NSTextAlignmentCenter;
    self.movYear3.font = [UIFont systemFontOfSize:12];
    self.movYear3.textColor = [UIColor lightGrayColor];
    [self.movView addSubview:self.movYear3];
    [_movYear3 release];
    
    
    [_scrollView autorelease];
    [_movView autorelease];
    
    
}


-(void)creatPerson6
{
    
    self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    self.scrollView.delegate = self;
    self.scrollView.contentSize = CGSizeMake(0, HEIGHT);
    self.scrollView.showsHorizontalScrollIndicator = NO;
    self.scrollView.userInteractionEnabled = YES;
    [self addSubview:self.scrollView];
    
    self.HUD = [MBProgressHUD showHUDAddedTo:self.scrollView animated:YES];
    self.HUD.labelText = @"正在加载中";
    [self.HUD show:YES];

    
    self.backImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 90)];
//    [self.backImageView setBackgroundColor:[UIColor whiteColor]];
    [self.scrollView addSubview:self.backImageView];
    [self.backImageView release];
    
    self.image = [[UIImageView alloc]initWithFrame:CGRectMake(10, 40, 100, 140)];
    [self.scrollView addSubview:self.image];
    [_image release];
    
    self.ratingFinal = [[UILabel alloc]initWithFrame:CGRectMake(320, 40, 30, 30)];
    self.ratingFinal.textColor = [UIColor orangeColor];
    [self.scrollView addSubview:self.ratingFinal];
    [_ratingFinal release];
    
    self.nameCn = [[UILabel alloc]initWithFrame:CGRectMake(self.image.frame.origin.x+self.image.frame.size.width+10, self.image.frame.origin.y-10, 200, 30)];
    self.nameCn.font = [UIFont boldSystemFontOfSize:20];
    [self.scrollView addSubview:self.nameCn];
    [_nameCn release];
    
    self.nameEn = [[UILabel alloc]initWithFrame:CGRectMake(self.nameCn.frame.origin.x, self.nameCn.frame.origin.y+35, 200, 30)];
    [self.scrollView addSubview:self.nameEn];
    self.nameEn.font = [UIFont systemFontOfSize:14];
    [_nameEn release];
    
    self.birthDay = [[UILabel alloc]initWithFrame:CGRectMake(self.nameEn.frame.origin.x, self.nameEn.frame.origin.y+30, 100, 20)];
    self.birthDay.textColor = [UIColor lightGrayColor];
    self.birthDay.font = [UIFont systemFontOfSize:12];
    [self.scrollView addSubview:self.birthDay];
    [_birthDay release];
    
    self.address = [[UILabel alloc]initWithFrame:CGRectMake(self.birthDay.frame.origin.x, self.birthDay.frame.origin.y+20, 200, 20)];
    self.address.textColor = [UIColor lightGrayColor];
    self.address.font = [UIFont systemFontOfSize:12];
    [self.scrollView addSubview:self.address];
    [_address release];
    
    self.profession = [[UILabel alloc]initWithFrame:CGRectMake(self.address.frame.origin.x, self.address.frame.origin.y+20, 200, 20)];
    self.profession.textColor = [UIColor lightGrayColor];
    self.profession.font = [UIFont systemFontOfSize:12];
    [self.scrollView addSubview:self.profession];
    [_profession release];
    
    self.content = [[UILabel alloc]initWithFrame:CGRectMake(self.image.frame.origin.x, self.image.frame.origin.y+self.image.frame.size.height, 355, 80)];
    self.content.numberOfLines = 0;
//    [self.content sizeToFit];
    self.content.userInteractionEnabled = YES;
    
    self.content.font = [UIFont systemFontOfSize:15];
//    self.content.scrollEnabled = NO;
    [self.scrollView addSubview:self.content];
    [_content release];
    
    self.button1 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.button1.frame = CGRectMake(0, 0, 355, 80);
    [self.button1 addTarget:self action:@selector(button1Action:) forControlEvents:UIControlEventTouchUpInside];
    [self.content addSubview:self.button1];
    self.buttonState = NO;
    
    self.unfold = [[UIImageView alloc]initWithFrame:CGRectMake(180, self.content.frame.origin.y+self.content.frame.size.height - 10, 30, 30)];
    
    [self.scrollView addSubview:self.unfold];
    [_unfold release];
    
//拍过电影
    self.movView = [[UIView alloc]initWithFrame:CGRectMake(0, self.content.frame.origin.y+self.content.frame.size.height+50, WIDTH, 350)];
//    self.movView.backgroundColor = [UIColor blackColor];
    self.movView.userInteractionEnabled = YES;
    [self.scrollView addSubview:self.movView];
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 30, 80, 30)];
    self.titleLabel.text = @"主要作品";
    self.titleLabel.font = [UIFont boldSystemFontOfSize:20];
    [_titleLabel release];
    
    self.movImage1 = [[UIImageView alloc]initWithFrame:CGRectMake(10, self.titleLabel.frame.origin.y+50, 100, 130)];
    self.movImage1.userInteractionEnabled = YES;
    [self.movView addSubview:self.movImage1];
    [_movImage1 release];
    
    self.firstButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.firstButton.frame = CGRectMake(0, 0, self.movImage1.frame.size.width / 2, self.movImage1.frame.size.height / 2);
    [self.firstButton addTarget:self action:@selector(buttonAction1:) forControlEvents:UIControlEventTouchUpInside];
    [self.movImage1 addSubview:self.firstButton];
    
    
    self.movName1 = [[UILabel alloc]initWithFrame:CGRectMake(10, self.movImage1.frame.origin.y+self.movImage1.frame.size.height+10, self.movImage1.frame.size.width, 40)];
    self.movName1.numberOfLines = 0;
    self.movName1.font = [UIFont systemFontOfSize:14];
    self.movName1.textAlignment = NSTextAlignmentCenter;
    [self.movView addSubview:self.movName1];
    [_movName1 release];
    
    self.movYear1 = [[UILabel alloc]initWithFrame:CGRectMake(10, self.movName1.frame.origin.y+40, self.movName1.frame.size.width, 20)];
    self.movYear1.textAlignment = NSTextAlignmentCenter;
    self.movYear1.font = [UIFont systemFontOfSize:13];
    self.movYear1.textColor = [UIColor lightGrayColor];
    [self.movView addSubview:self.movYear1];
    [_movYear1 release];
    
    self.movImage2 = [[UIImageView alloc]initWithFrame:CGRectMake(self.movImage1.frame.origin.x+self.movImage1.frame.size.width+20, self.movImage1.frame.origin.y, 100, 130)];
    self.movImage2.userInteractionEnabled = YES;
    [self.movView addSubview:self.movImage2];
    [_movImage2 release];
    
    self.secondButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.secondButton.frame = CGRectMake(0, 0, self.movImage2.frame.size.width, self.movImage2.frame.size.height);
    [self.secondButton addTarget:self action:@selector(buttonAction2:) forControlEvents:UIControlEventTouchUpInside];
    [self.movImage2 addSubview:self.secondButton];
    
    
    self.movName2 = [[UILabel alloc]initWithFrame:CGRectMake(self.movImage2.frame.origin.x, self.movImage2.frame.origin.y+self.movImage2.frame.size.height+10, self.movImage2.frame.size.width, 40)];
    self.movName2.numberOfLines = 0;
    self.movName2.font = [UIFont systemFontOfSize:13];
    self.movName2.textAlignment = NSTextAlignmentCenter;
    [self.movView addSubview:self.movName2];
    [_movName2 release];
    
    self.movYear2 = [[UILabel alloc]initWithFrame:CGRectMake(self.movImage2.frame.origin.x, self.movName2.frame.origin.y+40, self.movName2.frame.size.width, 20)];
    self.movYear2.textAlignment = NSTextAlignmentCenter;
    self.movYear2.font = [UIFont systemFontOfSize:12];
    self.movYear2.textColor = [UIColor lightGrayColor];
    [self.movView addSubview:self.movYear2];
    [_movYear2 release];
    
    self.movImage3 = [[UIImageView alloc]initWithFrame:CGRectMake(self.movImage2.frame.origin.x+self.movImage2.frame.size.width+20, self.movImage2.frame.origin.y, 100, 130)];
    self.movImage3.userInteractionEnabled = YES;
    [self.movView addSubview:self.movImage3];
    [_movImage3 release];
    
    self.thirdButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.thirdButton.frame = CGRectMake(0, 0, self.movImage3.frame.size.width, self.movImage3.frame.size.height);
    [self.thirdButton addTarget:self action:@selector(buttonAction3:) forControlEvents:UIControlEventTouchUpInside];
    [self.movImage3 addSubview:self.thirdButton];
    
    
    self.movName3 = [[UILabel alloc]initWithFrame:CGRectMake(self.movImage3.frame.origin.x, self.movImage3.frame.origin.y+self.movImage3.frame.size.height+10, self.movImage3.frame.size.width, 40)];
    self.movName3.numberOfLines = 0;
    self.movName3.font = [UIFont systemFontOfSize:13];
    self.movName3.textAlignment = NSTextAlignmentCenter;
    [self.movView addSubview:self.movName3];
    [_movName3 release];
    
    self.movYear3 = [[UILabel alloc]initWithFrame:CGRectMake(self.movImage3.frame.origin.x, self.movName3.frame.origin.y+40, self.movName1.frame.size.width, 20)];
    self.movYear3.textAlignment = NSTextAlignmentCenter;
    self.movYear3.font = [UIFont systemFontOfSize:12];
    self.movYear3.textColor = [UIColor lightGrayColor];
    [self.movView addSubview:self.movYear3];
    [_movYear3 release];
    

    [_scrollView autorelease];
    [_movView autorelease];
    

}

-(void)creatPersonPlus
{
    
    self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    self.scrollView.delegate = self;
    self.scrollView.contentSize = CGSizeMake(0, HEIGHT);
    self.scrollView.showsHorizontalScrollIndicator = NO;
    self.scrollView.userInteractionEnabled = YES;
    [self addSubview:self.scrollView];
    
    self.HUD = [MBProgressHUD showHUDAddedTo:self.scrollView animated:YES];
    self.HUD.labelText = @"正在加载中";
    [self.HUD show:YES];
    
    
    self.backImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 90)];
    //    [self.backImageView setBackgroundColor:[UIColor whiteColor]];
    [self.scrollView addSubview:self.backImageView];
    [self.backImageView release];
    
    self.image = [[UIImageView alloc]initWithFrame:CGRectMake(10, 40, 110, 150)];
    [self.scrollView addSubview:self.image];
    [_image release];
    
    self.ratingFinal = [[UILabel alloc]initWithFrame:CGRectMake(360, 40, 40, 40)];
    self.ratingFinal.textColor = [UIColor orangeColor];
    [self.scrollView addSubview:self.ratingFinal];
    [_ratingFinal release];
    
    self.nameCn = [[UILabel alloc]initWithFrame:CGRectMake(self.image.frame.origin.x+self.image.frame.size.width+10, self.image.frame.origin.y-10, 200, 30)];
    self.nameCn.font = [UIFont boldSystemFontOfSize:21];
    [self.scrollView addSubview:self.nameCn];
    [_nameCn release];
    
    self.nameEn = [[UILabel alloc]initWithFrame:CGRectMake(self.nameCn.frame.origin.x, self.nameCn.frame.origin.y+35, 200, 30)];
    [self.scrollView addSubview:self.nameEn];
    self.nameEn.font = [UIFont systemFontOfSize:15];
    [_nameEn release];
    
    self.birthDay = [[UILabel alloc]initWithFrame:CGRectMake(self.nameEn.frame.origin.x, self.nameEn.frame.origin.y+30, 100, 20)];
    self.birthDay.textColor = [UIColor lightGrayColor];
    self.birthDay.font = [UIFont systemFontOfSize:13];
    [self.scrollView addSubview:self.birthDay];
    [_birthDay release];
    
    self.address = [[UILabel alloc]initWithFrame:CGRectMake(self.birthDay.frame.origin.x, self.birthDay.frame.origin.y+20, 200, 20)];
    self.address.textColor = [UIColor lightGrayColor];
    self.address.font = [UIFont systemFontOfSize:13];
    [self.scrollView addSubview:self.address];
    [_address release];
    
    self.profession = [[UILabel alloc]initWithFrame:CGRectMake(self.address.frame.origin.x, self.address.frame.origin.y+20, 200, 20)];
    self.profession.textColor = [UIColor lightGrayColor];
    self.profession.font = [UIFont systemFontOfSize:13];
    [self.scrollView addSubview:self.profession];
    [_profession release];
    
    self.content = [[UILabel alloc]initWithFrame:CGRectMake(self.image.frame.origin.x, self.image.frame.origin.y+self.image.frame.size.height+10, 375, 80)];
    self.content.numberOfLines = 0;
    //    [self.content sizeToFit];
    self.content.userInteractionEnabled = YES;
    
    self.content.font = [UIFont systemFontOfSize:16];
    //    self.content.scrollEnabled = NO;
    [self.scrollView addSubview:self.content];
    [_content release];
    
    self.button1 = [UIButton buttonWithType:UIButtonTypeCustom];
    self.button1.frame = CGRectMake(0, 0, 370, 80);
    [self.button1 addTarget:self action:@selector(buttonPlusAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.content addSubview:self.button1];
    self.buttonState = NO;
    
    self.unfold = [[UIImageView alloc]initWithFrame:CGRectMake(190, self.content.frame.origin.y+self.content.frame.size.height - 10, 30, 30)];
    [self.scrollView addSubview:self.unfold];
    [_unfold release];
    //拍过电影
    self.movView = [[UIView alloc]initWithFrame:CGRectMake(0, self.content.frame.origin.y+self.content.frame.size.height+50, WIDTH, 350)];
    //    self.movView.backgroundColor = [UIColor blackColor];
    self.movView.userInteractionEnabled = YES;
    [self.scrollView addSubview:self.movView];
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 30, 80, 30)];
    self.titleLabel.text = @"主要作品";
    self.titleLabel.font = [UIFont boldSystemFontOfSize:20];
    [_titleLabel release];
    
    self.movImage1 = [[UIImageView alloc]initWithFrame:CGRectMake(10, self.titleLabel.frame.origin.y+50, 115, 150)];
    self.movImage1.userInteractionEnabled = YES;
    [self.movView addSubview:self.movImage1];
    [_movImage1 release];
    
    self.firstButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.firstButton.frame = CGRectMake(0, 0, self.movImage1.frame.size.width / 2, self.movImage1.frame.size.height / 2);
    [self.firstButton addTarget:self action:@selector(buttonAction1:) forControlEvents:UIControlEventTouchUpInside];
    [self.movImage1 addSubview:self.firstButton];
    
    
    self.movName1 = [[UILabel alloc]initWithFrame:CGRectMake(10, self.movImage1.frame.origin.y+self.movImage1.frame.size.height+10, self.movImage1.frame.size.width, 40)];
    self.movName1.numberOfLines = 0;
    self.movName1.font = [UIFont systemFontOfSize:15];
    self.movName1.textAlignment = NSTextAlignmentCenter;
    [self.movView addSubview:self.movName1];
    [_movName1 release];
    
    self.movYear1 = [[UILabel alloc]initWithFrame:CGRectMake(10, self.movName1.frame.origin.y+40, self.movName1.frame.size.width, 20)];
    self.movYear1.textAlignment = NSTextAlignmentCenter;
    self.movYear1.font = [UIFont systemFontOfSize:14];
    self.movYear1.textColor = [UIColor lightGrayColor];
    [self.movView addSubview:self.movYear1];
    [_movYear1 release];
    self.movImage2 = [[UIImageView alloc]initWithFrame:CGRectMake(self.movImage1.frame.origin.x+self.movImage1.frame.size.width+20, self.movImage1.frame.origin.y, 115, 150)];
    self.movImage2.userInteractionEnabled = YES;
    [self.movView addSubview:self.movImage2];
    [_movImage2 release];
    
    self.secondButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.secondButton.frame = CGRectMake(0, 0, self.movImage2.frame.size.width, self.movImage2.frame.size.height);
    [self.secondButton addTarget:self action:@selector(buttonAction2:) forControlEvents:UIControlEventTouchUpInside];
    [self.movImage2 addSubview:self.secondButton];
    
    
    self.movName2 = [[UILabel alloc]initWithFrame:CGRectMake(self.movImage2.frame.origin.x, self.movImage2.frame.origin.y+self.movImage2.frame.size.height+10, self.movImage2.frame.size.width, 40)];
    self.movName2.numberOfLines = 0;
    self.movName2.font = [UIFont systemFontOfSize:14];
    self.movName2.textAlignment = NSTextAlignmentCenter;
    [self.movView addSubview:self.movName2];
    [_movName2 release];
    
    self.movYear2 = [[UILabel alloc]initWithFrame:CGRectMake(self.movImage2.frame.origin.x, self.movName2.frame.origin.y+40, self.movName2.frame.size.width, 20)];
    self.movYear2.textAlignment = NSTextAlignmentCenter;
    self.movYear2.font = [UIFont systemFontOfSize:13];
    self.movYear2.textColor = [UIColor lightGrayColor];
    [self.movView addSubview:self.movYear2];
    [_movYear2 release];
    
    self.movImage3 = [[UIImageView alloc]initWithFrame:CGRectMake(self.movImage2.frame.origin.x+self.movImage2.frame.size.width+20, self.movImage2.frame.origin.y, 115, 150)];
    self.movImage3.userInteractionEnabled = YES;
    [self.movView addSubview:self.movImage3];
    [_movImage3 release];
    
    self.thirdButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.thirdButton.frame = CGRectMake(0, 0, self.movImage3.frame.size.width, self.movImage3.frame.size.height);
    [self.thirdButton addTarget:self action:@selector(buttonAction3:) forControlEvents:UIControlEventTouchUpInside];
    [self.movImage3 addSubview:self.thirdButton];
    
    
    self.movName3 = [[UILabel alloc]initWithFrame:CGRectMake(self.movImage3.frame.origin.x, self.movImage3.frame.origin.y+self.movImage3.frame.size.height+10, self.movImage3.frame.size.width, 40)];
    self.movName3.numberOfLines = 0;
    self.movName3.font = [UIFont systemFontOfSize:14];
    self.movName3.textAlignment = NSTextAlignmentCenter;
    [self.movView addSubview:self.movName3];
    [_movName3 release];
    
    self.movYear3 = [[UILabel alloc]initWithFrame:CGRectMake(self.movImage3.frame.origin.x, self.movName3.frame.origin.y+40, self.movName1.frame.size.width, 20)];
    self.movYear3.textAlignment = NSTextAlignmentCenter;
    self.movYear3.font = [UIFont systemFontOfSize:13];
    self.movYear3.textColor = [UIColor lightGrayColor];
    [self.movView addSubview:self.movYear3];
    [_movYear3 release];
    
    
    [_scrollView autorelease];
    [_movView autorelease];
    
    
}

- (void)create
{
    [self.movView addSubview:self.titleLabel];
    self.unfold.image = [UIImage imageNamed:@"iconfont-zhankai.png"];
    
    UIImageView *firstImageView = [[UIImageView alloc] initWithFrame:CGRectMake((self.movImage1.frame.size.width - 40) / 2, (self.movImage1.frame.size.height - 40) / 2, 40, 40)];
    firstImageView.image = [UIImage imageNamed:@"iconfont-bofang-2.png"];
    [self.firstButton addSubview:firstImageView];
    
    UIImageView *secondImageView = [[UIImageView alloc] initWithFrame:CGRectMake((self.movImage2.frame.size.width - 40) / 2, (self.movImage2.frame.size.height - 40) / 2, 40, 40)];
    secondImageView.image = [UIImage imageNamed:@"iconfont-bofang-2.png"];
//    [secondImageView setBackgroundColor:[UIColor redColor]];
    [self.secondButton addSubview:secondImageView];
    
    UIImageView *thirdImageView = [[UIImageView alloc] initWithFrame:CGRectMake((self.movImage3.frame.size.width - 40) / 2, (self.movImage3.frame.size.height - 40) / 2, 40, 40)];
    thirdImageView.image = [UIImage imageNamed:@"iconfont-bofang-2.png"];
    [self.thirdButton addSubview:thirdImageView];

    
}
-(void)buttonAction1:(UIButton *)button
{
    NSLog(@"movie1ID = %ld",self.movieId1);
    [self.myButtonDelegate present:self.movieId1];

}

-(void)buttonAction2:(UIButton *)button
{
    NSLog(@"movie2ID = %ld",self.movieId2);
    [self.myButtonDelegate present:self.movieId2];
}

-(void)buttonAction3:(UIButton *)button
{
    NSLog(@"movie3ID = %ld",self.movieId3);
    [self.myButtonDelegate present:self.movieId3];
}


-(CGSize)getHight:(NSString *)str
{
    CGSize size = CGSizeMake(355, FLT_MAX);
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:self.content.font,NSFontAttributeName, nil];
    CGSize actualsize = [str boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil].size;
    return actualsize;

    

}


-(void)button1Action:(UIButton *)button
{
    if (self.buttonState == NO) {
        float height = [self getHight:self.content.text].height;
        self.content.frame = CGRectMake(self.image.frame.origin.x, self.image.frame.origin.y+self.image.frame.size.height, 355, height);
        [self.content sizeToFit];
        self.scrollView.contentSize = CGSizeMake(0, self.content.frame.origin.y+self.content.frame.size.height + self.movImage1.frame.origin.y + self.movImage1.frame.size.height + self.movYear1.frame.origin.y + self.movYear1.frame.size.height - 50);
        self.movView.frame = CGRectMake(0, self.content.frame.origin.y+self.content.frame.size.height+50, WIDTH, 350);
        button.frame = CGRectMake(0, 0, self.content.frame.size.width, self.content.frame.size.height);
        self.unfold.frame = CGRectMake(180, self.content.frame.origin.y+self.content.frame.size.height-10, 30, 30);
        self.unfold.image = [UIImage imageNamed:@"iconfont-shouhui.png"];
        self.buttonState = YES;
    }
    else
    {
        self.content.frame = CGRectMake(self.image.frame.origin.x, self.image.frame.origin.y+self.image.frame.size.height, 355, 80);
        self.movView.frame = CGRectMake(0, self.content.frame.origin.y+self.content.frame.size.height+50, WIDTH, 350);
        self.scrollView.contentSize = CGSizeMake(0, HEIGHT );
        button.frame = CGRectMake(0, 0, self.content.frame.size.width, self.content.frame.size.height);
        self.unfold.frame = CGRectMake(180, self.content.frame.origin.y+self.content.frame.size.height-10, 30, 30);
        self.unfold.image = [UIImage imageNamed:@"iconfont-zhankai.png"];
        self.buttonState = NO;
        
        
    }
    
}


-(void)button5Action:(UIButton *)button
{
    if (self.buttonState == NO) {
        float height = [self getHight:self.content.text].height;
        self.content.frame = CGRectMake(self.image.frame.origin.x, self.image.frame.origin.y+self.image.frame.size.height, 300, height);
        [self.content sizeToFit];
        self.scrollView.contentSize = CGSizeMake(0, self.content.frame.origin.y+self.content.frame.size.height + self.movImage1.frame.origin.y + self.movImage1.frame.size.height + self.movYear1.frame.origin.y + self.movYear1.frame.size.height - 50);
        self.movView.frame = CGRectMake(0, self.content.frame.origin.y+self.content.frame.size.height+50, WIDTH, 350);
        button.frame = CGRectMake(0, 0, self.content.frame.size.width, self.content.frame.size.height);
        self.unfold.frame = CGRectMake(135, self.content.frame.origin.y+self.content.frame.size.height-10, 30, 30);
        self.unfold.image = [UIImage imageNamed:@"iconfont-shouhui.png"];
        self.buttonState = YES;
    }
    else
    {
        self.content.frame = CGRectMake(self.image.frame.origin.x, self.image.frame.origin.y+self.image.frame.size.height, 300, 80);
        self.movView.frame = CGRectMake(0, self.content.frame.origin.y+self.content.frame.size.height+10, WIDTH, 350);
        self.scrollView.contentSize = CGSizeMake(0, HEIGHT );
        button.frame = CGRectMake(0, 0, self.content.frame.size.width, self.content.frame.size.height);
        self.unfold.frame = CGRectMake(135, self.content.frame.origin.y+self.content.frame.size.height-10, 30, 30);
        self.unfold.image = [UIImage imageNamed:@"iconfont-zhankai.png"];
        self.buttonState = NO;

    
    }

}

-(void)buttonPlusAction:(UIButton *)button
{
    if (self.buttonState == NO) {
        float height = [self getHight:self.content.text].height;
        self.content.frame = CGRectMake(self.image.frame.origin.x, self.image.frame.origin.y+self.image.frame.size.height, 375, height);
        [self.content sizeToFit];
        self.scrollView.contentSize = CGSizeMake(0, self.content.frame.origin.y+self.content.frame.size.height + self.movImage1.frame.origin.y + self.movImage1.frame.size.height + self.movYear1.frame.origin.y + self.movYear1.frame.size.height - 50);
        self.movView.frame = CGRectMake(0, self.content.frame.origin.y+self.content.frame.size.height+50, WIDTH, 350);
        button.frame = CGRectMake(0, 0, self.content.frame.size.width, self.content.frame.size.height);
        self.unfold.frame = CGRectMake(190, self.content.frame.origin.y+self.content.frame.size.height-10, 30, 30);
        self.unfold.image = [UIImage imageNamed:@"iconfont-shouhui.png"];
        self.buttonState = YES;
    }
    else
    {
        self.content.frame = CGRectMake(self.image.frame.origin.x, self.image.frame.origin.y+self.image.frame.size.height, 375, 80);
        self.movView.frame = CGRectMake(0, self.content.frame.origin.y+self.content.frame.size.height+50, WIDTH, 350);
        self.scrollView.contentSize = CGSizeMake(0, HEIGHT );
        button.frame = CGRectMake(0, 0, self.content.frame.size.width, self.content.frame.size.height);
        self.unfold.frame = CGRectMake(190, self.content.frame.origin.y+self.content.frame.size.height-10, 30, 30);
        self.unfold.image = [UIImage imageNamed:@"iconfont-zhankai.png"];
        self.buttonState = NO;
        
        
    }
    
}

-(void)afnGetRequest
{
    
    AFNetworkReachabilityManager *netWorkManager = [AFNetworkReachabilityManager sharedManager];
    
    NSString *url_string = [NSString stringWithFormat:@"http://api.m.mtime.cn/Person/Detail.api?personId=%ld&locationId=729",self.perId];
    
    
    
    //[NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];  代表支持所有的接口类型
    
    AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"application/x-javascript",@"text/html",nil];
    [manager GET:url_string parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        [netWorkManager stopMonitoring];
//        NSLog(@"使用AFN进行get请求 ===  %@",responseObject);
        
        NSMutableArray *array = [NSMutableArray array];
//        self.array = [NSMutableArray array];
        array = [responseObject objectForKey:@"movies"];
        self.nameCn.text = [responseObject objectForKey:@"nameCn"];
//        self.nameCn.textColor = [UIColor whiteColor];
        self.nameEn.text = [responseObject objectForKey:@"nameEn"];
        self.ratingFinal.text = [responseObject objectForKey:@"ratingFinal"];
        self.address.text = [responseObject objectForKey:@"address"];
        self.profession.text = [responseObject objectForKey:@"profession"];
        self.content.text = [responseObject objectForKey:@"content"];
        NSString *str1 = [responseObject objectForKey:@"birthYear"];
        NSString *str2 = [responseObject objectForKey:@"birthMonth"];
        NSString *str3 = [responseObject objectForKey:@"birthDay"];
        self.birthDay.text = [NSString stringWithFormat:@"%@-%@-%@",str1,str2,str3];
        self.ratingFinal.text = [responseObject objectForKey:@"ratingFinal"];
        NSString *urlStr = [responseObject objectForKey:@"image"];
        NSURL *url = [NSURL URLWithString:urlStr];
        [self.image sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"111111.png"]];
        
        [self.backImageView sd_setImageWithURL:url];
        [self.backImageView setContentScaleFactor:[[UIScreen mainScreen] scale]];
        self.backImageView.contentMode =  UIViewContentModeScaleAspectFill;
//        self.backImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
        self.backImageView.alpha = 0.1;
        
        
        NSMutableDictionary *dic1 = [array objectAtIndex:0];
        NSMutableDictionary *dic2 = [array objectAtIndex:1];
        NSMutableDictionary *dic3 = [array objectAtIndex:2];
        
        self.movieId1 = [[dic1 objectForKey:@"id"]integerValue];
        self.movieId2 = [[dic2 objectForKey:@"id"]integerValue];
        self.movieId3 = [[dic3 objectForKey:@"id"]integerValue];
     
        
        self.movName1.text = [dic1 objectForKeyedSubscript:@"name"];
        self.movName2.text = [dic2 objectForKeyedSubscript:@"name"];
        self.movName3.text = [dic3 objectForKeyedSubscript:@"name"];
        
       
         self.movYear1.text = [dic1 objectForKey:@"year"];
         self.movYear2.text = [dic2 objectForKey:@"year"];
         self.movYear3.text = [dic3 objectForKey:@"year"];
        
        NSString *urlStr1 = [dic1 objectForKey:@"image"];
        NSURL *url1 = [NSURL URLWithString:urlStr1];
        [self.movImage1 sd_setImageWithURL:url1 placeholderImage:[UIImage imageNamed:@"111111.png"]];
        NSString *urlStr2 = [dic2 objectForKey:@"image"];
        NSURL *url2 = [NSURL URLWithString:urlStr2];
        [self.movImage2 sd_setImageWithURL:url2 placeholderImage:[UIImage imageNamed:@"111111.png"]];
        NSString *urlStr3 = [dic3 objectForKey:@"image"];
        NSURL *url3 = [NSURL URLWithString:urlStr3];
        [self.movImage3 sd_setImageWithURL:url3 placeholderImage:[UIImage imageNamed:@"111111.png"]];
        
        [self create];
        [self.HUD hide:YES];
        
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        NSLog(@"失败==== %@",error);
        [self.HUD hide:YES];
        
    }];
    
}


@end
